package _1_leetcode_1_20._07整数翻转;

public class ExecuteMain {
    public static void main(String[] args) {
        int input = -123;
        System.out.println(reverse(input));
    }

    public static int reverse(int x) {
        long n = 0;
        while(x != 0) {
            n = n*10 + x%10;
            x = x/10;
        }
        return (int)n==n? (int)n:0;
    }
}
